<template>
  <div class="help_detail">
    <head-top head-title="邻里求助" goBack="true"></head-top>
    <div class="help_top">
      <div class="help_title border-bottom">
        <img
          :src="list.head_pic || 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=1651318081,2860235060&fm=27&gp=0.jpg'"
          alt="">
        <div class="help_msg">
          <div class="msg_top">
            <p>{{list.nickname}}</p>
            <p>
              <span class="phone-image"></span>
              <span ref="phone">{{list.phone}}</span>
            </p>
          </div>
          <div class="msg_bottom">
            <p>{{list.areas_name}}</p>
            <a type="button" v-on:click="phoneCall(list.phone)"><span>立即联系</span></a>
          </div>
        </div>
      </div>
    </div>
    <desc-pic :list="list"></desc-pic>
    <div class="message_bottom" v-show="flag">
      <span>发布时间：{{list.create_time * 1000 | dateFmt(('YYYY-MM-DD HH:mm:ss'))}}</span>
      <span>浏览人数：{{list.reading_amount}}</span>
    </div>
    <div class="line"></div>
    <comment :list="list" :lists="lists" @passMethods="_getDetails"></comment>
  </div>
</template>
<style lang="scss">
  @import '../../common/sass/mixin.scss';

  .help_detail {
    width: 100%;
    padding-top: 40px;
    background: #fff;
    .help_top {
      width: 100%;
      .help_title {
        height: 65px;
        margin: 0 10px;
        img {
          width: 44px;
          height: 44px;
          border-radius: 50%;
          float: left;
          margin-top: 10px;
        }
        .help_msg {
          float: right;
          width: 83%;
          height: 65px;
          .msg_top {
            width: 100%;
            height: 33px;
            p:first-child {
              float: left;
              font-size: 15px;
              line-height: 33px;
            }
            p:last-child {
              float: right;
              .phone-image {
                display: inline-block;
                width: 15px;
                height: 15px;
                background-size: 15px 15px;
                background-repeat: no-repeat;
                @include bgimg('./images/dianhua');
                vertical-align: middle;
                float: left;
                margin-top: 9px;
                margin-right: 10px;
              }
              span {
                font-size: 13px;
                float: right;
                line-height: 33px;
                color: #808080;
              }
            }
          }
          .msg_bottom {
            width: 100%;
            height: 32px;
            clear: both;
            p {
              float: left;
              line-height: 24px;
              font-size: 13px;
              color: #808080;
            }
            a {
              float: right;
              margin-right: 10px;
              border: 1px solid #0078de;
              border-radius: 5px;
              background: #fff;
              padding: 3px;
              outline: none;
              span {
                color: #0078de;
                font-size: 12px;
              }
            }
          }
        }
      }
    }
    .line {
      width: 100%;
      height: 10px;
      background: #f2f2f2;
    }
    .message_bottom {
      width: 100%;
      height: 26px;
      /*line-height: 44px;*/
      span:first-child {
        font-size: 13px;
        color: #999;
        float: left;
        margin-left: 10px;
      }
      span:last-child {
        font-size: 13px;
        color: #999;
        float: right;
        margin-right: 10px;
      }
    }
  }
</style>
<script>
  import headTop from '../header/Header.vue'
  import comment from '../common/comment.vue'
  import descPic from '../common/desPic.vue'
  import { getDetails } from '../../api/publishList.js'

  export default {
    name: 'HelpDetail',
    data () {
      return {
        // commonurl: 'https://ynwx.zgwyzxw.cn/',
        lists: [],
        list: {},
        flag: false
      }
    },
    components: {
      headTop,
      comment,
      descPic
    },
    mounted () {
      this._getDetails()
    },
    methods: {
      phoneCall: function (msg) {
//        console.log(msg)
        window.location.href = `tel://${msg}`
      },
      _getDetails () {
        getDetails(this.$route.params.id).then(res => {
          if (res.code === 200) {
            this.lists = res.data.comment
            this.list = res.data.neighbor
            this.flag = true
          }
        })
      }
    }
  }
</script>
